<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>控制台</title>
		<link rel="stylesheet" type="text/css" href="../public/Css/identify.css" />
		<link rel="stylesheet" type="text/css" href="../public/Css/layout.css" />
		<link rel="stylesheet" type="text/css" href="../public/Css/account.css" />
		<link rel="stylesheet" type="text/css" href="../public/Css/style.css" />
		<link rel="stylesheet" type="text/css" href="../public/Css/control_index.css" />
		<script type="text/javascript" src="../public/Js/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="../public/Js/layer/layer.js"></script>
		<script type="text/javascript" src="../public/Js/haidao.offcial.general.js"></script>
		<script type="text/javascript" src="../public/Js/select.js"></script>
		<script type="text/javascript" src="../public/Js/haidao.validate.js"></script>
		<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
		<link rel="stylesheet" href="../public/Css/bootstrap.min.css">
		<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
		<script src="../public/Css/bootstrap.min.js"></script>

	</head>

	<body>
	<?php include "../view/left1.html";?>
			<div class="view-product">
					<div class="message-manage">
						<div class="manage-head">
							<h6 class="padding-left manage-head-con">分类管理</h6>
						</div>
						<table class="table table-hover">
							<thead>
							<tr>
								<th>分类名称</th>
								<th>栏目描述</th>
								<th>文章数</th>
								<th>操作</th>
							</tr>
							</thead>
							<tbody>
							<?php foreach($class_row as $value):?>
							<?php
								$col_id = $value['col_id'];
								$sql = "select count(*) as art_num from article where col_id = $col_id";
									$num = $dao->fetchRow($sql);
									$num = $num['art_num'];
							?>
							<tr>
								<td><?php echo $value['col_content'];?></td>
								<td><?php echo $value['col_message'];?></td>
								<td><?php echo $num;?></td>
								<td>删除/编辑</td>
							</tr>
							<?php endforeach ?>
							</tbody>
						</table>
						<form role="form" style="width: 500px;margin-left: 100px;" action="./dle_class_insert.php" method="post" onsubmit="return Verification()">
							<div class="form-group">
								<label for="name">添加分类</label>
								<input type="text" class="form-control" id="class_name"  name="class_name"
									   placeholder="请输入分类名">
							</div>
							<div class="form-group">
								<input type="text" class="form-control" id="class_me" name="class_me"
									   placeholder="请输入分类描述">
							</div>
							<button type="submit" class="btn btn-default">提交</button>

						</form>
					</div>
				<div class="clear">
				</div>
				<div class="show-page padding-big-right hidden">
					<div class="page">
					</div>
				</div>
			</div>
		</div>

		<script>
			$(".sidebar-title").live('click', function() {
				if ($(this).parent(".sidebar-nav").hasClass("sidebar-nav-fold")) {
					$(this).next().slideDown(200);
					$(this).parent(".sidebar-nav").removeClass("sidebar-nav-fold");
				} else {
					$(this).next().slideUp(200);
					$(this).parent(".sidebar-nav").addClass("sidebar-nav-fold");
				}
			});
			function Verification() {
                if($(" #class_name ").val() ===''){
                    alert("请输入分类名");
                    return false;
                }else if($(" #class_me ").val() ===''){
                    alert("请输入分类描述");
                    return false;
				}else {
                    return true;
				}
            }
		</script>
	</body>

</html>